<%@ page contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html>  
<html>  
 <head>  
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">   
  <title>Exception</title>  
  <script type="text/javascript" src="./jquery-1.10.2.js"></script>  
  <script type="text/javascript">  
  $(function(){  
        init();  
    });  
     
  function init(){  
        $("#ajaxCreate").click(function(){  
            doAjax({userName: "Candy", realName: "Carol"});  
        })  
        $("#ajaxUpdate").click(function(){  
            doAjax({id: 1, userName: "Candy", realName: "Carol"});  
        })  
        $("#ajaxFail").click(function(){  
            doAjax({realName: "Carol"});  
        })  
    }  
  function doAjax(data) {  
      $.post("./test/ajaxAlert",data,function(t){  
            if(!t.isSuccess){  
                alert("操作失败, 原因：" + t.message);  
            }else{  
                alert("操作成功, 描述：" + t.message);  
            }  
        },"json").error(function(){  
            alert("未知错误");  
        });  
  }  
  </script>  
 </head>  
<body>  
  <br />  
  <a id="ajaxCreate" href="#">创建用户成功</a>  
  <br />  
  <a id="ajaxUpdate" href="#">修改用户成功</a>     
  <br />  
  <a id="ajaxFail" href="#">用户名为空创建失败</a>  
</body>  
</html>